// TODO: http request.
// 通过export方式导出，在导入时要加{ }，export default则不需要
// import * as info from "./test.js";//通过*来批量接收，as 来指定接收的名字
/*axios.creat([config])
var instance = axios.create({
  baseURL: 'https://some-domain.com/api/',
  timeout: 1000,
  headers: {'X-Custom-Header': 'foobar'}
});*/

import axios from 'axios'

// 基础地址.
// const apiUrl = "http://120.53.232.123:19999/api/v1/"
const apiUrl = "http://127.0.0.1:19999/api/v1/"

const instance = axios.create({
    baseURL: apiUrl,
    timeout: 10000,
});

export const request = (method, url, data) => {
    switch (method) {
        case "get": {
            return instance.get(url)
        }
        case "post": {
            return instance.post(url, data)
        }
    }
}